//
//  DetailHeaderView.m
//  一点互助
//
//  Created by rimi on 16/9/2.
//  Copyright © 2016年 zhangboqiu. All rights reserved.
//

#import "DetailHeaderView.h"
#import "AddFriendsViewController.h"
#import "UserModel.h"
#import "MemberViewController.h"

@implementation DetailHeaderView
+(instancetype)loadHeaderView{
    DetailHeaderView *view = [[DetailHeaderView alloc]init];
    UINib *nib = [UINib nibWithNibName:@"DetailHeaderView" bundle:nil];
    view = [[nib instantiateWithOwner:nil options:nil]firstObject];
    
    return view;
}
- (IBAction)addFriendBtnTaped:(id)sender {
    UserModel *user = [UserModel sharedUserModel];
    if (user.islogin) {
        AddFriendsViewController *vc = [[AddFriendsViewController alloc]init];
        if (self.niceNameLabel.text == nil) {
            vc.nickName = @"NULL";
            vc.idStr = [NSString stringWithFormat:@"%ld",(long)self.model.userId];
            vc.mobile = self.model.mobile;
        }else{
            vc.nickName = self.model.userNiceName;
            vc.idStr = [NSString stringWithFormat:@"%ld",(long)self.model.userId];
            vc.mobile = self.model.mobile;
        }
        [self.ownerVC.navigationController pushViewController:vc animated:YES];
    }else{
        MemberViewController *vc = [[MemberViewController alloc]init];
        [self.ownerVC.navigationController pushViewController:vc animated:YES];
    }
}
-(void)layoutSubviews{
    [super layoutSubviews];
    self.headerImageView.layer.cornerRadius = self.headerImageView.bounds.size.height/2;
    self.headerImageView.layer.masksToBounds = YES;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
